<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <script type="text/javascript" src="../../inc/ctx.jsp"></script>
        <script type="text/javascript" src="../js/g.js"></script>
        <link href="../css/com.css" type="text/css" rel="stylesheet"/>
    </head>
    <body>
        <div id="panel">
            <form id="queryFrm">
                <input name="rownum" id="rownum" value="" type="hidden" />
                <input name="crow" id="crow" value="" type="hidden" />
                <input name="currpage" id="currpage" value="" type="hidden" />
                <table border="0" cellspacing="0" cellpadding="0">
                    <tr class="trhd">
                        <td colspan="3"><h3 class="s1">反馈留言查询</h3></td>
                        <td width="11%">&nbsp;</td>
                        <td width="45%">&nbsp;</td>
                    </tr>
                    <tr>
                        <td width="9%">处理状态：</td>
                        <td width="20%">
                            <select id="dealstate" name="dealstate" style="width:100px;">
                                <option value="">-选择-</option>
                                <option value="0">未处理</option>
                                <option value="1">已处理</option>
                            </select>
                        </td>
                        <td width="15%">每页显示：
                            <select name="listsize" id="listsize">
                                <option value="10">10条</option>
                                <option value="20">20条</option>
                                <option value="50">50条</option>
                            </select>
                            &nbsp;</td>
                        <td class="r">留言时间：</td>
                        <td>
                            从 <input type="text" id="begintime" name="begintime" value="" maxlength="19" style="width:120px;" onclick="cdpn('begintime');"/>
                            到 <input type="text" id="endtime" name="endtime" value="" maxlength="19" style="width:120px;"  onclick="cdpn('endtime');"/>
                        </td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td><span id="tip_num"></span></td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td class="r">
                            <input onclick="FEED.list(1, 0);" name="submitBtn" type="button" class="button small orange" id="submitBtn" value="Φ 查询">
                            <input onclick="FEED.del();" name="delBtn" type="button" class="button small gray" id="delBtn" value="x 删除">
                        </td>
                    </tr>
                </table>
            </form>
        </div>


        <div class="databox">
            <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <th width="4%">&nbsp;<a href="javascript:ut.swapsel('sel');">反选</a></th>
                    <th width="5%">ID</th>
                    <th width="7%">姓名/昵称</th>
                    <th width="4%">性别</th>
                    <th width="9%">联系方式</th>
                    <th width="15%">邮箱</th>
                    <th width="21%">反馈标题</th>
                    <th width="7%">IP地址</th>
                    <th width="6%">处理状态</th>
                    <th width="9%">留言时间</th>
                    <th width="8%">操作</th>
                </tr>
                <tbody class="tbchg" id="datalist"></tbody>
            </table>
        </div>
        <div class="page" id="page"></div>

        <div style="display:block;clear:both;width:98%;height:50px;">&nbsp;</div>





        <!-- 数据处理 -->
        <script id="listTpl" type="text/html">
            {%for(var k in list){var e = list[k]; %}
        <tr>
            <td><input name="sel" type="checkbox" value="{%=e.msgid%}"/></td>
            <td>{%=e.msgid%}</td>
            <td>{%=e.nick%}</td>
            <td>{%=e.sex%}</td>
            <td>{%=e.tel%}<br/><span class="s1">{%=e.cityarea%}</span></td>
            <td>{%=e.email%}</td>
            <td class="s1">{%=e.title%} [<a href="javascript:;" onclick="FEED.view('{%=e.title%}','{%=e.msgid%}');">详情</a>]</td>
            <td><a  href="javascript:;" onclick="FEED.queryip('{%=e.ip%}');" title="点击查询IP详情">{%=e.ip%}</a></td>
            {% if(e.dealstate==0){ %}
            <td class="red">未处理</td>
            {% }else{ %}
            <td class="blue">已处理</td>
            {% } %}
            <td>{%=parseDate(e.postime,16)%}</td>
            <td>
                {% if(e.dealstate==0){ %}
                <a  href="javascript:;" onclick="FEED.modstate('{%=e.msgid%}');">标注处理</a>
                {% } %}
            </td>
        </tr>
        {%}%}
    </script>

    <script type="text/javascript">
        template.helper('parseDate',ut.parseDate);
 
        var $lsout = $('#datalist');
        var $ls = $('#listsize');
        var $rownum = $('#rownum');
        var $crow=$('#crow');
        var $curpage=$('#currpage');
        var FEED={
            list:function(pgno,r){
                var ls =parseInt($ls.val());
                var step =10;
                var cr = (ls * ( pgno - 1 ));
                $rownum.val(r);
                $crow.val(cr);
                $curpage.val(pgno);
                var params = ut.getFormData('#queryFrm');
                params._t=ut.r();
                $.get('../app/feedback/list_factor.shtm',params,function(d){
                    var x = d;
                    rn=x.rownum;
                    $('#tip_num').text('查到 '+rn+' 条信息');
                    $rownum.val(rn);
                    if(rn>0){
                        ut.outpage(pgno, rn, 'FEED.list','page', ls, step);
                        $lsout.html(template.render('listTpl',x));
                    }else{
                        $lsout.html('<tr><td colspan="11">暂无数据.</td></tr>');
                        $('#page').html('');
                    }
                }
            );
            },
            del:function(){
                var ida = ut.getselv('sel');
                if(va.isnull(ida)){ut.m('请选择需要删除的信息.');return;}
                if(!window.confirm("确定删除么?执行后不可恢复."))return;
                $.get('../app/feedback/delete_batch.shtm?t='+ut.r(), "ids="+ida, function(x){
                    var r = $.trim(x);
                    if(va.tint(r)){
                        ut.m('删除成功.已删除记录数为'+r);
                        FEED.list($curpage.val(),0);
                    }else{
                        ut.m('删除失败. '+r);
                    }
                });
            },
            modstate:function(id){
                if(!window.confirm("确定更新么?"))return;
                $.get('../app/feedback/update_deal_state.shtm?t='+ut.r(), "msgid="+id+"&state=1", function(x){
                    var r =  $.trim(x);
                    if(r=='ok'){
                        FEED.list($curpage.val(),0);
                    }else{
                        ut.m('更新失败. '+r);
                    }
                }); 
            },
            view:function(t,id){
                TxBox.load('ID：'+id+', '+t, '../app/feedback/query_msg.shtm?msgid='+id);
            },
            queryip:function(ip){
                win.open('http://www.baidu.com/s?wd='+ip);
            }
        };
    </script>
</body>
</html>
